package com.gec.yhzh.controller;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gec.yhzh.entity.Vaccine;
import com.gec.yhzh.entity.VaccineType;
import com.gec.yhzh.service.IVaccineService;
import com.gec.yhzh.service.IVaccineTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.metadata.IPage;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/vaccineType")
public class VaccineTypeController {
    @Autowired
    private IVaccineTypeService vaccineTypeService;
    //JSON解析工具
    ObjectMapper objectMapper = new ObjectMapper();
    @GetMapping
    public String  queryDoctors() throws JsonProcessingException {
        Map<String, Object> result = new HashMap<>();
        List<VaccineType> vaccineList = vaccineTypeService.list();
        if (vaccineList == null || vaccineList.isEmpty()) {
            result.put("flag",false );
            return objectMapper.writeValueAsString(result);
        }
        result.put("flag",true );
        result.put("list",vaccineList );
        return objectMapper.writeValueAsString(result);
    }
}